import unittest
from admin.basic import Agent
from admin.nav import NavAgent
import re

class ReTest(unittest.TestCase):
    def test_login(self):
        with open("bootstrap-icons.css",encoding="utf-8") as fh:
            data_str = fh.read()
            # res = re.findall("(?=.)bi-([\w-]*)(?=::)",data_str)
            res = re.findall("(?<=.bi-)[\w-]*(?=::)",data_str)
            print(res)

    pass

class NavTest(unittest.TestCase):
    def test_login(self):
        print("aaaa")
        pass
    def test_group_delete(self):
        agent = NavAgent()
        res = agent.login()
        res=agent.nav_group_delete({'id':8})
        print(res.text)
    def test_group_edit(self):
        agent = NavAgent()
        res = agent.login()
        res=agent.nav_group_edit({'id':7, 'name':'aaaa', 'icon':'aaaa', 'tag':'aaaa', 'display':1, 'display_order':0})
        print(res.text)
    def test_item_add(self):
        agent = NavAgent()
        res = agent.login()
        res=agent.nav_add({'name':'aaaaaaa','tag':'bbbbbb','group_id':7,'path':'aaaa/bbb/ccc'})
        print(res.text)
    def test_nav_edit(self):
        agent = NavAgent()
        res = agent.login()
        res=agent.nav_edit({'id':11, 'name':'aaaa', 'icon':'aaaa','path':'aaaa', 'group_id':8,'pre_id':0,'tag':'aaaa', 'display':1, 'display_order':0})
        print(res.text)
    def test_nav_delete(self):
        agent = NavAgent()
        res = agent.login()
        res=agent.nav_delete({'id':12})
        print(res.text)
    def test_nav(self):
        agent = NavAgent()
        res = agent.login()
        res = agent.nav_list()
        res = agent.nav_group_add({"name": "nnnnnn", "tag": "mmmmmm"})
        print(res)
    # def test_nav_add(self):
    #     agent = Agent()
    #     res = agent.login()
        # res = agent.nav_list()
        # res = agent.nav_group_add({"name":"nnnnnn","tag":"mmmmmm"})
        # print(res)
        # print(res.cookies)
        # print(res.request.headers)
        # print(agent.cookie)
        # agent.nav_add({"aa":"bb","cc":"dd"})
        # agent.nav_list()
        # pass

# if __name__ == '__main__':
#     unittest.main()
